package 延迟加载

class Player4 {
    lateinit var equipment: String

    fun ready() {
        equipment = "sharp knife"
    }

    fun battle() {
        if (::equipment.isInitialized) println("拿${equipment}战斗……") else println("equipment没有初始化")
    }
}

fun main() {
    val player4 = Player4()
    player4.ready()
    player4.battle()
}